package com.rest.demo.functional.concurrent;

import java.util.concurrent.TimeUnit;

/**
 * @author Administrator
 * @decription
 * @Date 2018-01-30 10:07
 */
public class RunnableDemo {

    public static void main(String[] args) {
        Runnable task = () -> {
          try {
              String name = Thread.currentThread().getName();
              System.out.println("Foo " + name);
              TimeUnit.MINUTES.sleep(1);
              System.out.println("Bar " + name);
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
        };
        Thread thread = new Thread(task);
        thread.start();
    }
}
